<template>
	<view class="page" :style="{minHeight:windowHeight+'px'}">
		<!-- <view>定制用车</view> -->
		<view class="head">
			<!-- <view style="height: 90rpx"></view> -->
			<view class="head-item">
				<view class="head-item-return" @click="gotoPage('/pagesUser/home/home')">
					<image src="../../../static/whiBg.png"></image>
				</view>
				<view class="head-item-title">定制用车</view>
				<view></view>
			</view>
			<view class="head-select">
				<!-- <view class="item-con-title">定制包车</view> -->
				<view class="head-select-con">
					<view v-if="att_info==1">个人用车</view>
					<view v-if="att_info==2">单位用车</view>
					<view v-if="att_info==3">旅行社用车</view>
					<!-- <input type="text" disabled="" v-if="att_info==1" placeholder="个人用车" />
					<input type="text" disabled="" v-if="att_info==2" placeholder="单位用车" />
					<input type="text" disabled="" v-if="att_info==3" placeholder="旅行社用车" /> -->
					<!-- <picker @change="selectChange" :range="arraySelect">				
				<label class="">{{arraySelect[order_type]}}</label>		
			</picker> -->
					<!-- <image src="../../../static/jiantou3.png"></image> -->
				</view>
			</view>
			<!-- <view class="head-item1">
				<view class="head-item1-con1">
					<view class="starTime">
						<picker mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change"
							@columnchange="columnchange">
							<view class="starTime">
								<input class="noweek" type="text" disabled="true" v-model="star_time"
									placeholder="请选择上车时间" placeholder-class="inputPlace" />
							</view>
						</picker>
					</view>
					<view class="dayNum">
						<text v-if="formData.end_time != ''">{{formData.days}}天</text>
						<image src="../../../static/user/jiantou.png"></image>
					</view>
					<view class="starTime">
						<picker mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change2"
							@columnchange="columnchange2">
							<view class="starTime">
								<input class="noweek" type="text" disabled="true" v-model="end_time"
									placeholder="请选择结束时间" placeholder-class="inputPlace" />
							</view>
						</picker>
					</view>
				</view>
				<view class="head-item1-con2">
					<view class="begin">
						<view class="dot"></view>
						<input class="origin" disabled="" @click="selectLocation('star',-1)" v-model="begin.b_name"
							placeholder="请选择上车地点" />
					</view>
					<view class="begin middle" v-for="(item,index) of middle">
						<view class="middle-left">
							<view class="close" @click="delectMiddle(index)">
								<image src="../../../static/close.png"></image>
							</view>
							<input @click="selectLocation('mid',index)" class="middle-left-content" disabled=""
								:value="item.m_name" placeholder="请选择停靠点" />
						</view>
			
					</view>
					<view class="end-box">
						<view class="begin end">
							<view class="end-box-yh">
								<image src="../../../static/user/icon-yh.png"></image>
							</view>
							<input class="origin" disabled="" @click="selectLocation('end',-1)"
								v-model="destination.d_name" placeholder="请选择下车地点" />
						</view>
						<image class="addImage" @click="add" src="../../../static/user/add.png"></image>
					</view>
				</view>
			</view> -->
			<view class="head-item1">
				<view class="head-item1-con2">
					<view class="begin">
						<view class="dot"></view>
						<input class="origin" disabled="" @click="selectLocation('star',-1)" v-model="begin.b_name"
							placeholder="请选择上车地点" />
					</view>
					<view class="begin middle" v-for="(item,index) of middle">
						<view class="middle-left">
							<view class="close" @click="delectMiddle(index)">
								<image src="../../../static/close.png"></image>
							</view>
							<input @click="selectLocation('mid',index)" class="middle-left-content" disabled=""
								:value="item.m_name" placeholder="请选择停靠点" />
						</view>

					</view>
					<view class="end-box">
						<view class="begin end">
							<view class="end-box-yh">
								<image src="../../../static/user/icon-yh.png"></image>
							</view>
							<input class="origin" disabled="" @click="selectLocation('end',-1)"
								v-model="destination.d_name" placeholder="请选择下车地点" />
						</view>
						<image class="addImage" @click="add" src="../../../static/user/add.png"></image>
					</view>
				</view>
				<view class="head-item1-con1">
					<view class="starTime">
						<image class="starTime-ima1" src="../../../static/user/icon-time.png"></image>
						<picker mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change"
							@columnchange="columnchange">
							<input type="text" disabled="true" v-if="star_time ==''" placeholder="请选择出发时间"
								placeholder-class="inputPlace" />
							<view class="star_time">{{star_time}}</view>
						</picker>
						<image class="starTime-ima2" src="../../../static/jiantou3.png"></image>
					</view>
					<view class="starTime">
						<picker class="starTime-day" @change="bindPickerChange2" :range="array2">
							<input placeholder="包车天数" disabled="" v-if="selectDay==''" />
							<view class="starTime-day-con" v-if="selectDay!=''">已选择{{formData.days}}天</view>
						</picker>
						<image class="starTime-ima2" src="../../../static/jiantou3.png"></image>
					</view>
				</view>
			</view>
			<!-- <view class="head-item1-con1">
				
				<view class="starTime">
					<image class="starTime-ima1" src="../../../static/user/icon-time.png"></image>
					<picker mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change"
						@columnchange="columnchange">
							<input  type="text" disabled="true" v-if="star_time ==''"
								placeholder="请选择出发时间" placeholder-class="inputPlace" />
								<view class="star_time">{{star_time}}</view>
					</picker>
					<image class="starTime-ima2" src="../../../static/jiantou3.png"></image>
				</view>
				<view class="starTime"> 
					<picker class="starTime-day" @change="bindPickerChange2" :range="array2">
						<input placeholder="包车天数" disabled="" v-if="selectDay==''" />
						<view class="starTime-day-con" v-if="selectDay!=''">已选择{{array2[index2]}}天</view>
					</picker>
					<image class="starTime-ima2" src="../../../static/jiantou3.png"></image>
				</view>
			</view> -->
		</view>
		<!-- <view class="scheduling">
			<view class="scheduling-title">行程安排</view>
			<view>页面内容有 出行时间、出发时间、出发地、目的地、到达时间</view>
		</view> -->
		<view class="box" v-if="busUseShow">
			<view class="shadow" @click="busUseClose"></view>
			<view class="box-content">
				<view class="box-head">
					<text>包车用途</text>
					<image @click="busUseClose" src="../../../static/close.png"></image>
				</view>
				<view class="box-type">
					<!-- <view  class="screen-type" v-for="(item,index) of selectYears2" @click="doSelectYear2(item.yearsid)">
				<view class="type-item" :class="year_id == index ? 'have' : ''" @click="busUseSel(item.name,item.yearsid)">{{item.name}}</view>
			</view> -->

					<view class="screen-type" v-for="(item,index) of busUseTab" @click="doSelectYear(item.id)">
						<view class="type-item" :class="busUseTabId == item.id ? 'have' : ''"
							@click="busUseTabSel(item)">{{item.purpose_name}}</view>
					</view>
					<!-- <span ref="manumotive" @click="getType1()">{{type1}}</span>
			<span ref="voluntarily" @click="getType2()">{{type2}}</span> -->
				</view>
			</view>
		</view>
		<view class="box" v-if="box">
			<view class="shadow" @click="close"></view>
			<view class="box-content">
				<view class="box-head">
					<text>定制周期</text>
					<image @click="close" src="../../../static/close.png"></image>
				</view>
				<view class="box-type">
					<span ref="manumotive" @click="getType1()">{{type1}}</span>
					<span ref="voluntarily" @click="getType2()">{{type2}}</span>
				</view>
			</view>
		</view>
		<view class="box ju-box" v-if="scheShow">
			<view class="shadow" @click="closescheShow"></view>
			<view class="box-content ju-box-content">
				<view class="box-head">
					<text>安排行程</text>
					<image @click="addSche" class="addImage2" src="../../../static/user/add.png"></image>
					<!-- <image class="closeSche" @click="closescheShow" src="../../../static/close.png"></image> -->
					<view class="box-head-sure" @click="scheSure">确定</view>
				</view>
				<view class="box-type" v-for="(item,indexSche) of scheduling" :key='indexSche'>
					<view class="box-type-item1">
						<input v-model="item.place_of_departure" placeholder="请填写行程起点" />
						
						<view class="box-type-item2-del">
							<image  class="box-type-item2-ima1" src="../../../static/ju.png"></image>
							<image @click="delectSche(item.indexSche)" class="box-type-item2-ima2" src="../../../static/delete.png"></image>
						</view>
						<input class="box-type-item1-con3" v-model="item.destination" placeholder="请填写行程终点" />
					</view>
					<view class="box-type-item2">
						<picker  mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change3($event,indexSche)"
							@columnchange="columnchange3">
							<view class="box-type-item2-sel" v-if="item.departure_time==''">请选择行程起点时间</view>
							<view class="star_time" v-else>{{item.departure_time}}</view>
						</picker>
						<picker  mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change4($event,indexSche)"
							@columnchange="columnchange4">
							<view class="box-type-item2-sel" v-if="item.arrival_time==''">请选择行程终点时间</view>
							<view class="star_time" v-else>{{item.arrival_time}}</view>
						</picker>
					</view>
				</view>
			</view>
		</view>
		<view class="box" v-if="payBox">
			<view class="shadow" @click="payClose"></view>
			<view class="box-content">
				<view class="box-head">
					<text>结算方式</text>
					<image @click="payClose" src="../../../static/close.png"></image>
				</view>
				<view class="box-type">
					<span ref="manumotive" @click="payTypeclick1()">{{payType1}}</span>
					<span ref="voluntarily" @click="payTypeclick2()">{{payType2}}</span>
				</view>
			</view>
		</view>
		<view class="box" v-if="driverShow">
			<view class="shadow" @click="driverClose"></view>
			<view class="box-content">
				<view class="box-head">
					<text>司机费用</text>
					<image @click="driverClose" src="../../../static/close.png"></image>
				</view>
				<view class="box-type">
					<view class="threeMeals">
						<view class="threeMeals-title">是否方便提供司机三餐</view>
						<view class="threeMeals-select">
							<radio-group @change="selectMeals">
								<label class="threeMeals-is" v-for="(item,index) in radioGroup" :key="index">
									<radio :value="item" :checked="item==statusMeals" />{{item}}
								</label>
							</radio-group>
						</view>
					</view>
					<view class="threeMeals">
						<view class="threeMeals-title">是否方便提供司机住宿</view>
						<view class="threeMeals-select">
							<radio-group @change="selectStay">
								<label class="threeMeals-is" v-for="(item,index) in radioGroup" :key="index">
									<radio :value="item" :checked="item==statusStay" />{{item}}
								</label>
							</radio-group>
						</view>
					</view>
					<view class="threeMeals">
						<view class="threeMeals-title">是否方便提供司机停车</view>
						<view class="threeMeals-select">
							<radio-group @change="selectPacking">
								<label class="threeMeals-is" v-for="(item,index) in radioGroup" :key="index">
									<radio :value="item" :checked="item==statusPacking" />{{item}}
								</label>
							</radio-group>
						</view>
					</view>
				</view>
				<view class="driver-cost" @click="sureCost">确定</view>
			</view>
		</view>
		<!-- <view class="box" >
	<view class="shadow" ></view>
	<view class="box-content box-selectCar">
		<view class="box-head box-selectHead">
			<text>请选择车辆</text>
			<image @ src="../../../static/close.png"></image>
		</view>
		<view class="selectCar-head">
			<view class="selectCar-tick">
				<view>乘车人数<text>10</text>人</view>
				<view class="selectCar-tick-con2">已选择<text>10</text>辆</view>
				<view>可乘坐<text>10</text>人</view>
			</view>
			<view class="selectCar-head-clear">
				清空
			</view>
		</view>
		<view class="selectCar-content">
			<view v-for="(item,index) in carType">
				<view class="selceCar-con-left">
					<image :src="item.carIcon"></image>
				</view>
				<view class="selceCar-con-right">
					<view>
						<text>{{}}</text>
						<view></view>
					</view>
					<view>
						{{item.carDescribe}}
					</view>
					<view>
						{{item.carInc}}
					</view>
				</view>
			</view>
		</view>
	</view>
</view> -->
		<view class="item">
			<view class="item-con">
				<view class="item-con-title">总里程</view>
				<view class="select-type">
					<view class="select-type-gl" v-if="formData.total_km==''">0km</view>
					<view class="select-type-gl" v-if="formData.total_km!=''">{{formData.total_km}}km</view>
					<!-- <input v-model="formData.total_km" disabled="" placeholder="" /> -->
					<!-- <view class="select-type-img select-type-gl">
						<text v-if="formData.total_km==''">0km</text>
						<image v-if="formData.total_km==''" src="../../../static/jiantou3.png"></image>
					</view> -->
				</view>

			</view>
			<view class="item-con">
				<view class="item-con-title">安排行程</view>
				<view class="select-type" @click="openscheShow">
					<input disabled="" placeholder="请安排行程" v-if="scheduling[0].date_time==''" />
					<input disabled="" placeholder="已安排" v-else />
					<view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view>
				</view>

			</view>
			<view class="item-con">
				<view class="item-con-title">定制周期</view>
				<view class="select-type" @click="boxSelect">
					<input v-model="type" disabled="" placeholder="请选择乘车类型" />
					<view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view>
				</view>

			</view>
			<view class="item-con">
				<view class="item-con-title">包车用途</view>
				<view class="select-type" @click="busUseOpen">
					<input v-model="busUse" disabled="" placeholder="请选择包车用途" />
					<view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view>
				</view>

			</view>
			<view class="item-con">
				<view class="item-con-title">路程往返</view>
				<view class="select-type back-type">
					<view class="back-type-back" :class="backType==2?'back-type-back back-type-all' : ''"
						@click="tabTypeFunc(2)">往返</view>
					<view class="back-type-one " :class="backType==1?'back-type-back back-type-all' : ''"
						@click="tabTypeFunc(1)">单程</view>
				</view>
			</view>
			<view class="item-con">
				<view class="item-con-title">出行人数</view>
				<view class="select-type">
					<input type="number" v-model="formData.passenger" placeholder="请输入乘车人数" />
				</view>
			</view>
		</view>
		<!-- <view class="item item1">
	<view class="item1-select">
		<text>选择车辆</text>
		<image src="../../../static/jiantou3.png"></image>
	</view>
	<view class="item1-add">
		<view class="item1-add-select">
			<image src="../../../static/user/selectCar.png"></image>
		</view>
		<view class="item1-add-title">请选择车辆</view>
	</view>
</view> -->
		<view class="item item2">
			<view class="item-con">
				<view class="item-con-title">车辆</view>
				<view class="select-type">
					<!-- <input v-if="driverCost.length != 0" disabled="" placeholder="已选择" /> -->
					<input v-model="formData.car_number" type="number" placeholder="请输入所需的车辆数" />
					<text>辆</text>
					<!-- <view class="select-type-img">
				<image src="../../../static/jiantou3.png"></image>
			</view> -->
				</view>
			</view>
			<view class="item-con">
				<view class="item-con-title">司机费用</view>
				<view class="select-type" @click="driverSelect">
					<input v-if="driverCost2.length != 0" disabled="" placeholder="已选择" />
					<input v-else disabled="" placeholder="请选择司机费用" />
					<view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view>
				</view>
			</view>
			<view class="item-con">
				<view class="item-con-title">结算方式</view>
				<view class="select-type" v-if="att_info == 1">
					<input disabled="" placeholder="现付" />
					<!-- <view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view> -->
				</view>
				<view class="select-type" v-if="att_info == 3 ||att_info == 2">
					<input disabled="" placeholder="月结" />
					<!-- <view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view> -->
				</view>
				<!-- <view class="select-type" @click="paySelect" v-if="att_info == 2">
					<input v-model="payType" disabled="" placeholder="请选择结算方式" />
					<view class="select-type-img">
						<image src="../../../static/jiantou3.png"></image>
					</view>
				</view> -->
			</view>

			<view class="item-con">
				<view class="item-con-title">缴纳保证金</view>
				<input class="item-con-cashNum" v-if="cashType == 1" v-model="formData.front_money" type="number"
					placeholder="请输入保证金" />
				<view class="select-type back-type">
					<view class="back-type-back" :class="cashType==1?'back-type-back back-type-all' : ''"
						@click="tabCashFunc(1)">是</view>
					<view class="back-type-one " :class="cashType==2?'back-type-back back-type-all' : ''"
						@click="tabCashFunc(2)">否</view>
				</view>
			</view>
		</view>
		<view class="item item3">
			<view class="item-con">
				<text class="item-con-title">订单成本：</text>
				<view class="item-con-price">
					<view class="item-con-price-cost_price">{{formData.cost_price}} 元</view>
				</view>
			</view>
			<view class="item-con">
				<text class="item-con-title">本次费用</text>
				<view class="item-con-price">
					<input type="number" v-model="formData.price" placeholder="请输入本次出价" />
					<text class="item-con-price-cost_price">元</text>
				</view>
			</view>
		</view>
		<view class="item item3">
			<view class="">
				<label class="item-con-title">备注:</label>
				<!-- <text class="item-con-title">备注</text> -->
				<textarea style="resize: none;" v-model="formData.remark"></textarea>
				<!-- <input type="text" v-model="formData.remark" placeholder="备注" /> -->
			</view>
		</view>
		<view class="bottom-tip">
			<view>
				<checkbox-group class="check-box" @change="staChange()">
					<checkbox value="cb" class="checkbox" :checked="status" />
				</checkbox-group>
			</view>
			<view>
				我已阅读并同意联合拉
			</view>
			<view class="tip-title" @click="openMsgagreem">《用车协议》</view>
			<view class="msgagreem-item" v-if="msgShow">
				<view class="msgagreem-item-title">
					<view></view>
					<!-- <view>{{listData.article_title}}</view> -->
					<image @click="closeMsgagreem" src="../../../static/app/close.png"></image>
				</view>
				<view class="msgagreem" v-html="listData.article_content">

				</view>
			</view>
		</view>
		<view style="height: 120rpx;"></view>
		<view class="button">
			<view class="btn-item">
				<!-- <view class="predict">
					<view class="predictPrice" v-if="formData.cost_price!=''">
						预计<text class="cost_price">{{formData.cost_price}}</text>元
					</view>
				</view> -->
				<view class="formData" @click="$noMultipleClicks(submitData)">
					提交订单
				</view>
			</view>
		</view>


	</view>
</template>
<!-- <script src="https://webapi.amap.com/maps?v=1.4.15&key=fec2e6cbc6c00d83d8d4549a11902fb8"></script> -->
<script>
	//import AMap2 from '../../../common/gedt.js'
	import dateTimePicker from '../../../common/dateTimePicker.js'
	export default {
		// // 注册组件
		// components: {
		// 	footUser
		// },
		data() {
			return {
				noClick: true,
				listData: [], //文章详情
				msgShow: false,
				star_time: '',
				end_time: '',
				carType: [{
					carName: '小型客车',
					carNum: 0, //
					carDescribe: '后备箱客房1-3个行李箱', //车辆描述
					carInc: '上汽/海狮/丰田/同等级别车型',
					carIcon: '../../../static/car1.png', //车图片
					carTypeId: 1,
				}],
				addCarType: '',
				driverCost2: [],
				driverCost: {
					three_meals: '',
					stay: '',
					packing: ''
				},
				driverShow: false, //司机费用显示
				statusMealsId: 0,
				statusMeals: '',
				statusStayId: 0,
				statusStay: '',
				statusPackingId: 0,
				statusPacking: '',
				radioGroup: ['是', '否'],
				busUseShow: false, //选项包车用途显示
				busUseTab: [], //获取包车用途的标签
				busUseTabId: '1',
				year_id: '',
				busUse: [{}],
				arraySelect: ['--请选择--', '单位、企业、学校', '旅行社', '个人'],
				order_type: 0,
				status: false, //协议的勾选状态
				type: '',
				type1: '长期用车',
				type2: '短期用车',
				payType1: '下现付',
				payType2: '月结',
				payType: '',
				payBox: false, //结算方式显示
				box: false, //定制类型显示
				backType: 1, //往返类型id
				cashType: 2, //保证金
				formData: {
					star_time: '', //时间
					end_time: '', //用车结束时间
					days: '', //天数
					passenger: '', //乘车人数
					purpose_id: '1', //标签id
					back_type: '', //往返类型，1单程，2往返
					remark: '', //备注
					front_money: '', //定金
					driver_price: '', //	司机费用
					car_type: '', //	车辆类型
					settlement_type: '1', //结算方式，1下单结，月结
					custom_type: '', //定制类型
					car_number: '', //需要车辆数
					//ensure_money:'',//保证金
					order_type: '', //1单位用车 2旅行用车 3个人用车
					price: '', //本次费用
					total_km: '', //总里程
					cost_price: '', //预计的价钱成本
				},
				scheduling:[
					{
						date_time: '', //出行时间,
						place_of_departure: '', //出发地,
						destination: '', //目的地,
						departure_time: '', //出发时间,
						arrival_time: '', //到达时间	
					},
				],
				// scheduling: {
				// 	date_time: '', //出行时间,
				// 	place_of_departure: '', //出发地,
				// 	destination: '', //目的地,
				// 	departure_time: '', //出发时间,
				// 	arrival_time: '', //到达时间				
				// },
				//destination: '', //目的地,
				departure_time: '', //出发时间,
				arrival_time: '', //到达时间			
				busUse: '', //显示包车用途
				time: '',
				dateTimeArray: null,
				dateTime: null,
				startYear: 2000,
				endYear: 2050,
				upTower: '',
				dating: '',
				isShow: false,
				phone: '0773-2625000',
				windowHeight: '', //视高
				location: '桂林市', //定位
				begin: {
					b_name: '', //位置名称
					b_address: '', //详细地址
					b_latitude: '', //纬度
					b_longitude: '', //经度
				}, //起点的位置
				destination: {
					d_name: '', //位置名称
					d_address: '', //详细地址
					d_latitude: '', //纬度
					d_longitude: '', //经度
				}, //终点
				addNum: 0, //标记点的次数
				middle: [],
				middleInfo: {},
				wayPoiStr: [], //标记点的经纬度
				a1: 0,
				p_star: '',
				p_end: '',
				p_mid: '',
				money: '', //定金加保证金
				att_info: '', //认证状态
				allPrice: '', //预计金额
				aaa: '',
				Adate: '',
				Adate2: '',
				Adate3: '',
				Adate4: '',
				con1: '',
				array2: ['0.5', ],
				index2: 0,
				selectDay: '',
				scheShow:false,
				days:'',//毫秒
			};
		},
		onLoad(e) {

			uni.getSystemInfo({
				success: (res) => {
					this.windowHeight = res.windowHeight;
				}
			});
			this.date1();
			let obj = dateTimePicker.dateTimePicker(this.startYear, this.endYear, this.dating)
			this.dateTimeArray = obj.dateTimeArray
			this.dateTime = obj.dateTime
			if (e.select == 1) {
				this.formData.star_time = JSON.parse(e.formData).star_time;
				this.star_time = this.formData.star_time.substr(5)
				this.formData.days = JSON.parse(e.formData).days;
				this.selectDay = this.formData.days;
				this.begin = JSON.parse(e.begin);
				this.destination = JSON.parse(e.destination);
				this.middle = JSON.parse(e.middle);
				this.p_star = this.begin.b_longitude + ',' + this.begin.b_latitude;
				this.p_end = this.destination.d_longitude + ',' + this.destination.d_latitude;
				if (this.middle != '') {
					let a = [];
					this.middle.forEach(item => {
						a += item.m_longitude + "," + item.m_latitude + ";";
					});
					this.wayPoiStr = a.substring(0, a.length - 1);
				}
				if (this.begin.b_name != '' && this.destination.d_name != '') {
					this.calDistance();
				}

				//this.con3 = JSON.parse(e.begin);
				//console.log(this.p_star)
				//console.log(this.p_end)
			}
			let i = 1;
			for (i; i <= 1000; i++) {
				this.array2.push(i)

			}
			//console.log(this.array2)
			//this.bas();
			//this.loadScrpit();
			// let aq2 = require('../../../common/gedt.js');
			// this.aaa=new aq2.AMapWX({
			// 	key:'2891cafbf938afdf81bf83d53ce5b4ec'
			// });
		},
		onShow() {
			this.getPhone();
			this.getbusUseTab();
			//this.getLocation();
			this.getAttInfo();
			this.getInfo();
		},
		mounted() {
			// let aq2 = require('../../../common/gedt.js');
			// this.aaa=new aq2.AMapWX({
			// 	key:'2891cafbf938afdf81bf83d53ce5b4ec'
			// });
		},
		onPullDownRefresh() {
			this.getInfo();
			this.getPhone();
			this.getbusUseTab();
			//this.getLocation();
			this.getAttInfo();
			//this.date1();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			delectSche(idx){
				let self = this;
				self.scheduling.splice(idx, 1);
			},
			scheSure(){
				let self = this;
				self.scheShow = false;
				//console.log(self.scheduling)
			},
			openscheShow(){
				if(this.formData.star_time == ''){
					uni.showToast({
						title:'请选择出发时间',
						duration:2000,
						icon:'none'
					});
					return;
				}
				if(this.formData.days == ''){
					uni.showToast({
						title:'请选择包车天数',
						duration:2000,
						icon:'none'
					});
					return;
				}
				this.scheShow = true;
				//this.addSche();
			},
			closescheShow(){
				this.scheShow = false
			},
			/* 打开协议 */
			closeMsgagreem() {
				this.msgShow = false;
			},
			/* 打开协议 */
			openMsgagreem() {
				this.msgShow = true;
			},
			// loadScrpit() {
			// 	var script = document.createElement('script');
			// 	script.src = 'https://webapi.amap.com/maps?v=1.4.15&key=2891cafbf938afdf81bf83d53ce5b4ec&callback=mapInit';
			// 	document.body.appendChild(script);
			// },
			/* 获取用户认证接口 */
			getAttInfo() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('user.user/attestation_info', {}, function(res) {
					//console.log(res.data.info)
					self.att_info = res.data.info.types;
					if(res.data.info.types==1){
						self.formData.order_type = 3;
					}else if(res.data.info.types==2){
						self.formData.order_type = 1;
					}else if(res.data.info.types==3){
						self.formData.order_type = 2;
					}
					//self.formData.order_type = res.data.info.types;
					uni.hideLoading();
				});
			},
			sureCost() {
				let self = this;
				let add = {
					three_meals: self.statusMealsId, //三餐
					stay: self.statusStayId, //住宿
					packing: self.statusPackingId, //车位
				}
				self.driverCost.three_meals = self.statusMealsId; //三餐
				self.driverCost.stay = self.statusStayId; //三餐
				self.driverCost.packing = self.statusPackingId; //三餐
				self.driverCost2.push(add);
				self.formData.driver_price = JSON.stringify(self.driverCost)
				self.driverShow = false;
				//console.log(self.formData.driver_price)
				// self._post('order.CarOrder/get_purpose',
				// {
				// 	driver_price
				// },
				// function(res) {

				// 	uni.hideLoading();
				// });
			},
			/* 选择司机三餐 */
			selectMeals(e) {
				this.statusMeals = e.detail.value;
				if (this.statusMeals == '是') {
					this.statusMealsId = 1;
				} else {
					this.statusMealsId = 0;
				}
				//console.log('三餐'+this.statusMealsId)
			},
			/* 选择司机住宿 */
			selectStay(e) {
				this.statusStay = e.detail.value;
				if (this.statusStay == '是') {
					this.statusStayId = 1;
				} else {
					this.statusStayId = 0;
				}
				//console.log('住宿' + this.statusStayId)
			},
			/* 选择司机停车 */
			selectPacking(e) {
				this.statusPacking = e.detail.value;
				if (this.statusPacking == '是') {
					this.statusPackingId = 1;
				} else {
					this.statusPackingId = 0;
				}
				//console.log('停车' + this.statusPackingId)
			},
			/* 获取包车用途的标签 */
			getbusUseTab() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('order.CarOrder/get_purpose', {}, function(res) {
					self.busUseTab = res.data.list;
					uni.hideLoading();
				});
			},
			/* 关闭司机费用选择 */
			driverClose() {
				this.driverShow = false;
			},
			/* 打开司机费用选择 */
			driverSelect() {
				this.driverShow = true;
			},
			/* 包车用途赋值 */
			busUseSel(name, id) {
				this.formData.busUse = name;
				this.busUseShow = false;
			},
			busUseOpen() {
				this.busUseShow = true;
			},
			/* 关闭包车用途的筛选 */
			busUseClose() {
				this.busUseShow = false;
			},
			busUseTabSel(value) {
				this.busUse = value.purpose_name;
				this.formData.purpose_id = value.id
				this.busUseShow = false;
				//console.log(value)
			},
			doSelectYear2: function(item) {
				if (item != this.year_id) {
					this.year_id = item;
				}

			},
			doSelectYear: function(item) {
				if (item != this.busUseTabId) {
					this.busUseTabId = item;
					this.formData.purpose_id = item;
				}

			},

			selectChange: function(e) {
				this.order_type = e.target.value;
				console.log(this.order_type)
				//this.jg=this.array[this.index]		
			},
			/* 获取复选框的状态 */
			staChange() {
				this.status = !this.status;
				//console.log(this.status)
			},
			/* 结算方式 */
			payTypeclick1(e) {
				this.payType = '';
				this.payType = this.payType1;
				this.formData.settlement_type = 1;
				this.payBox = false;
			},
			payTypeclick2(e) {
				this.payType = '';
				this.payType = this.payType2;
				this.formData.settlement_type = 2;
				this.payBox = false;
			},
			paySelect() {
				this.payBox = true;
			},
			payClose() {
				this.payBox = false;
			},
			/* 定制类型 */
			getType1(e) {
				this.type = '';
				this.type = this.type1;
				this.formData.custom_type = 2;
				this.box = false;
			},
			getType2(e) {
				this.type = '';
				this.type = this.type2;
				this.formData.custom_type = 1;
				this.box = false;
			},
			boxSelect() {
				this.box = true;
			},
			close() {
				this.box = false;
			},
			tabCashFunc(e) {
				if (e != this.cashType) {
					this.cashType = e;
					this.formData.front_money = '';
				}
			},
			tabTypeFunc(e) {
				if (e != this.backType) {
					this.backType = e;
					if (this.p_star != '' && this.p_end != '') {

						this.calDistance();
					}

					//console.log(this.backType)
				}
			},
			/* 选择包车天数 */
			bindPickerChange2(e) {
				//console.log(e)
				this.index2 = e.target.value
				this.selectDay = this.array2[e.target.value]
				this.formData.days = this.selectDay;
				if(this.formData.star_time != ''){
					this.days = this.formData.days*24*3600*1000+this.Adate3;			
					var date = new Date(this.days);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
					var Y = date.getFullYear() + '-';
					var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
					var D = date.getDate() + ' ';
					var h = date.getHours() + ':';
					var m = date.getMinutes() ;
					//var s = date.getSeconds();
					//console.log(Y+M+D+h+m+s)
					this.formData.end_time = Y+M+D+h+m
					//console.log(this.formData.end_time)
				}
				//console.log(this.formData.days)
			},
			/* 获取当前的时间 */
			date1() {
				let today = new Date();
				let year = today.getFullYear()
				let month = today.getMonth() + 1;
				let day = today.getDate()
				let h = today.getHours();
				let m = today.getMinutes();
				let s = today.getSeconds(); // 在小于10的数字钱前加一个‘0’
				h = checkTime(h);
				m = checkTime(m);
				s = checkTime(s);
				month = checkTime(month)
				day = checkTime(day)

				function checkTime(i) {
					if (i < 10) {
						i = "0" + i;
					}
					return i;
				}
				let temp = `${year}/${month}/${day} ${h}:${m}`;
				this.dating = temp;
				this.arr = temp;
				this.startYear = `${year}`;
				//console.log(temp)
			},
			//时间格式化
			withData(param) {
				return param < 10 ? '0' + param : '' + param;
			},
			/* 时间 */
			change(e) {
				//console.log(e)
				this.date1();
				let value = []
				e.detail.value.forEach((val, index) => {
					value.push(this.dateTimeArray[index][val])
				})
				let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				
				if (dateArray != '') {
					var d3 = new Date(this.dating.replace(/-/g, '/'));
					var d1 = new Date(dateArray.replace(/-/g, '/'));
					//var d2 = new Date(this.formData.end_time.replace(/-/g, '/'));
					//var ms = Math.abs(d2.getTime() - d1.getTime()); //毫秒
					//var d = ms / 1000 / 60 / 60 / 24; //转为天
					//this.formData.days = Math.ceil(d);
					this.Adate = d3.getTime(); //当前时间
					//this.Adate2 = d2.getTime(); //所选择的结束时间+4个小时
					this.Adate3 = d1.getTime(); //所选择的开始时间-3个小时
					if (dateArray == '' || this.Adate > this.Adate3) {
						uni.showToast({
							title: '请选择正确的开始上车时间',
							duration: 2000,
							icon: 'none'
						});
						return;
					}
					this.formData.star_time = dateArray
					this.star_time = dateArray2;
					if(this.formData.days != ''){
						console.log(555)
						this.days = this.formData.days*24*3600*1000+this.Adate3;			
						var date = new Date(this.days);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
						var Y = date.getFullYear() + '-';
						var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
						var D = date.getDate() + ' ';
						var h = date.getHours() + ':';
						var m = date.getMinutes() ;
						//var s = date.getSeconds();
						//console.log(Y+M+D+h+m+s)
						this.formData.end_time = Y+M+D+h+m
					}
					
				}
			},
			/* 时间 */
			columnchange(e) {
				let dateArr = this.dateTimeArray
				let arr = this.dateTime
				arr[e.detail.column] = e.detail.value
				dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
				this.dateTimeArray = dateArr
				this.dateTime = arr
			},
			/* 时间 */
			change2(e) {
				this.date1();
				//console.log(e)
				let value = []
				e.detail.value.forEach((val, index) => {
					value.push(this.dateTimeArray[index][val])
				})
				let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				this.formData.end_time = dateArray
				this.end_time = dateArray2;
				if (this.formData.end_time != '') {
					var d3 = new Date(this.dating.replace(/-/g, '/'));
					var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
					var d2 = new Date(this.formData.end_time.replace(/-/g, '/'));
					var ms = Math.abs(d2.getTime() - d1.getTime()); //毫秒
					var d = ms / 1000 / 60 / 60 / 24; //转为天
					this.formData.days = Math.ceil(d);
					//console.log(eval(d3.getTime()-7200));
					this.Adate = d3.getTime(); //当前时间
					this.Adate2 = d2.getTime(); //所选择的结束时间+4个小时
					this.Adate3 = d1.getTime(); //所选择的开始时间-3个小时
					//this.Adate4 = d2.getTime();//结束的时间
					// console.log(this.Adate3)
					// console.log(this.Adate)
				}

				//console.log(d)
				//console.log(dateArray2)
			},
			/* 时间 */
			columnchange2(e) {
				let dateArr = this.dateTimeArray
				let arr = this.dateTime
				arr[e.detail.column] = e.detail.value
				dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
				this.dateTimeArray = dateArr
				this.dateTime = arr
			},
			/* 时间 */
			change3(e,idx) {
				this.date1();
				//console.log(e)
				//console.log(idx)
				let value = []
				e.detail.value.forEach((val, index) => {
					value.push(this.dateTimeArray[index][val])
				})
				let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				//this.departure_time[idx] = dateArray2;
				
				
				var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
				this.Adate3 = d1.getTime(); //所选择的开始时间
				var d2 = new Date(dateArray.replace(/-/g, '/'));
				var Adate4 = d2.getTime();
				if(Adate4<this.Adate3){
					uni.showToast({
						title:'所选择的时间不能小于出发时间',
						duration:2000,
						icon:'none'
					})
					return;
				}
				if(Adate4>this.days){
					uni.showToast({
						title:'所选择的时间不能大于用车结束时间',
						duration:2000,
						icon:'none'
					})
					return;
				}
				this.scheduling[idx].departure_time = dateArray;
				if(this.scheduling[idx].arrival_time !=''){
					let a1 = this.scheduling[idx].arrival_time;
					let a2 = this.scheduling[idx].departure_time;
					let b1 = a1.substr(0,10);
					let b2 = a2.substr(0,10);
					this.scheduling[idx].date_time = b1				
				}
			},
			/* 时间 */
			columnchange3(e) {
				//console.log(e)
				//console.log(idx)
				let dateArr = this.dateTimeArray
				let arr = this.dateTime
				arr[e.detail.column] = e.detail.value
				dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
				this.dateTimeArray = dateArr
				this.dateTime = arr
			},
			/* 时间 */
			change4(e,idx) {
				this.date1();
				//console.log(e)
				let value = []
				e.detail.value.forEach((val, index) => {
					value.push(this.dateTimeArray[index][val])
				})
				let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				//this.arrival_time[idx] = dateArray2;
				
				//var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
				//this.Adate3 = d1.getTime(); //所选择的开始时间
				var d2 = new Date(dateArray.replace(/-/g, '/'));
				var Adate4 = d2.getTime();
				if(Adate4<this.Adate3){
					uni.showToast({
						title:'所选择的时间不能小于出发时间',
						duration:2000,
						icon:'none'
					})
					return;
				}
				if(Adate4>this.days){
					uni.showToast({
						title:'所选择的时间不能大于用车结束时间',
						duration:2000,
						icon:'none'
					})
					return;
					//console.log(3333);
				}
				this.scheduling[idx].arrival_time = dateArray;
				if(this.scheduling[idx].departure_time !=''){
					let a1 = this.scheduling[idx].arrival_time;
					let a2 = this.scheduling[idx].departure_time;
					let b1 = a1.substr(0,10);
					let b2 = a2.substr(0,10);
					this.scheduling[idx].date_time = b1
					//console.log(this.scheduling[idx].date_time)
				}
				// this.formData.end_time = dateArray
				// this.end_time = dateArray2;
				// if (this.formData.end_time != '') {
				// 	var d3 = new Date(this.dating.replace(/-/g, '/'));
				// 	var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
				// 	var d2 = new Date(this.formData.end_time.replace(/-/g, '/'));
				// 	var ms = Math.abs(d2.getTime() - d1.getTime()); //毫秒
				// 	var d = ms / 1000 / 60 / 60 / 24; //转为天
				// 	this.formData.days = Math.ceil(d);
				// 	//console.log(eval(d3.getTime()-7200));
				// 	this.Adate = d3.getTime(); //当前时间
				// 	this.Adate2 = d2.getTime(); //所选择的结束时间+4个小时
				// 	this.Adate3 = d1.getTime(); //所选择的开始时间-3个小时
				// 	//this.Adate4 = d2.getTime();//结束的时间
				// 	// console.log(this.Adate3)
				// 	// console.log(this.Adate)
				// }
			
				//console.log(d)
				//console.log(dateArray2)
			},
			/* 时间 */
			columnchange4(e) {
				let dateArr = this.dateTimeArray
				let arr = this.dateTime
				arr[e.detail.column] = e.detail.value
				dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
				// this.dateTimeArray = dateArr
				// this.dateTime = arr
			},
			/* 获取手机号码 */
			getPhone() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('index/config', {}, function(res) {
					self.phone = res.data.service_phone;
					self.loadding = true;
					uni.hideLoading();
				});
			},
			showPhone() {
				let self = this;
				self.isShow = true;
			},
			closePhone() {
				let self = this;
				self.isShow = false;
			},
			/* 拨打电话 */
			phoneCall() {
				let self = this;
				uni.makePhoneCall({
					phoneNumber: self.phone
				});
			},
			/* 删除标记点 */
			delectMiddle(idx) {
				let self = this;
				self.middle.splice(idx, 1);
				self.wayPoiStr = [];
				if (self.middle != '') {
					let a = [];
					self.middle.forEach(item => {
						a += item.m_longitude + "," + item.m_latitude + ";";
					});
					self.wayPoiStr = a.substring(0, a.length - 1);
				}
				if (self.destination.d_name != '') {
					self.calDistance();
				}
			},
			/* 添加行程安排 */
			addSche() {								
				let addMiddle = {
					date_time: '', //出行时间,
					place_of_departure: '', //出发地,
					destination: '', //目的地,
					departure_time: '', //出发时间,
					arrival_time: '', //到达时间	
				};
				this.scheduling.push(addMiddle);
			},
			/* 添加标记点 */
			add() {
				if (this.begin.b_name == '') {
					uni.showToast({
						title: '请先选择上车地点',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				this.addNum += 1;
				let addMiddle = {
					m_name: '', //位置名称
					m_address: '', //详细地址
					m_latitude: '', //纬度
					m_longitude: '', //经度
				};
				this.middle.push(addMiddle);
			},
			selectLocation(type, index) {
				uni.navigateTo({
					url: "../choose-location/choose-location?select=1&type=" + type + '&index=' + index,
					animationType: "slide-in-bottom",
				})
			},
			confirmPoint(type, point, index) {
				let self = this;
				if (type == 'star') {
					self.begin.b_name = point.name;
					self.begin.b_address = point.address;
					self.begin.b_latitude = point.point.latitude;
					self.begin.b_longitude = point.point.longitude;
					self.p_star = point.point.longitude + ',' + point.point.latitude;
				} else if (type == 'end') {
					self.destination.d_name = point.name;
					self.destination.d_address = point.address;
					self.destination.d_latitude = point.point.latitude;
					self.destination.d_longitude = point.point.longitude;
					self.p_end = point.point.longitude + ',' + point.point.latitude;
					self.calDistance();
				} else if (type == 'mid') {
					self.middle[index].m_name = point.name;
					self.middle[index].m_address = point.address;
					self.middle[index].m_latitude = point.point.latitude;
					self.middle[index].m_longitude = point.point.longitude;
					if (self.destination.d_name != '') {
						self.calDistance();
					}
				}
			},
			calDistance() {
				let self = this;
				//let a1=[];
				// a1.push(self.p_star);								
				// self.middle.forEach(item =>{
				// 	a1.push([item.m_longitude,item.m_latitude])
				// })				
				// if(self.p_end != ''){
				// 	a1.push(self.p_end);
				// }
				if (self.middle != '') {
					let a = [];
					self.middle.forEach(item => {
						a += item.m_longitude + "," + item.m_latitude + ";";
					});
					self.wayPoiStr = a.substring(0, a.length - 1);
				}

				//let a2 = JSON.stringify(a1)
				//var dis = AMap.GeometryUtil.distanceOfLine(a1);
				//console.log(a1);
				// console.log(self.wayPoiStr)
				// console.log(self.p_star);
				// console.log(self.p_end)
				uni.showLoading({
					title: '加载中'
				});
				self._post('order.CarOrder/get_distance', {
						origin: self.p_star,
						destination: self.p_end,
						waypoints: self.wayPoiStr
					},
					function(res) {
						if (res.code == 1) {
							self.formData.total_km = Number(res.data.distance) * Number(self.backType)
							self.formData.cost_price = Number(res.data.cost_price) * Number(self.backType);
						}
						uni.hideLoading();
					});
				//self.allPrice = Math.ceil(dis)*3*self.backType;
				//console.log(self.allPrice);
			},
			/* 获取当前位置 */
			getLocation() {
				let self = this;
				uni.getLocation({
					type: 'wgs84',
					geocode: true,
					success: function(res) {
						self.location = res.address.city;
					},
					fail: function(res) {

					}
				});
			},
			sure() {
				let self = this;
				let a = [];
				self.middle.forEach(item => {
					a += item.m_longitude + "," + item.m_latitude + ";";
				});
				self.wayPoiStr = a.substring(0, a.length - 1)
				self.middleInfo = self.middle;
				let waypoistr = self.wayPoiStr;
				let lineInformation = JSON.stringify(self.middle)
				let star_address = JSON.stringify(self.begin)
				let end_address = JSON.stringify(self.destination)
				//console.log(middle)
				self._post('order.carorder/add', {
						star_address,
						lineInformation,
						end_address,
						waypoistr
					},
					function(res) {

					});
			},
			/* 提交订单 */
			submitData() {
				let self = this;
				
				self.formData.back_type = self.backType;
				if (self.att_info == 1) {
					self.formData.settlement_type = 1
					self.payType = 1;
				} else if (self.att_info == 3 || self.att_info == 2) {
					self.formData.settlement_type = 2
					self.payType = 2;
				}
				if (self.formData.star_time == '' || self.Adate > self.Adate3) {
					uni.showToast({
						title: '请选择正确的开始上车时间',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if(self.formData.days == ''){
					uni.showToast({
						title: '请选择包车天数',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				// if (self.formData.end_time == '' || self.Adate3 > self.Adate2) {
				// 	uni.showToast({
				// 		title: '请选择正确的用车结束时间',
				// 		duration: 2000,
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				if (self.begin.b_name == '') {
					uni.showToast({
						title: '请选择上车地点',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.destination.d_name == '') {
					uni.showToast({
						title: '请选择下车地点时间',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if( self.scheduling[0].date_time==''){
					uni.showToast({
						title: '请安排行程',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.custom_type == '') {
					uni.showToast({
						title: '请选择定制类型',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.purpose_id == '') {
					uni.showToast({
						title: '请选择包车用途',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.back_type == '') {
					uni.showToast({
						title: '请选择路程往返',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.passenger == '') {
					uni.showToast({
						title: '请输入出行人数',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.car_number == '') {
					uni.showToast({
						title: '请输入所需的车辆数',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.formData.driver_price=='') {
					uni.showToast({
						title: '请选择司机费用',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.payType == '') {
					uni.showToast({
						title: '请选择结算方式',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if (self.cashType == '') {
					uni.showToast({
						title: '请输入缴纳的定金',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				if(self.formData.price <self.formData.cost_price){
					uni.showToast({
						title:'输入的本次价格不能少于订单成本',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				// if(self.formData.front_money == ''){
				// 	uni.showToast({
				// 		title:'请输入缴纳的定金',
				// 		duration: 2000,
				// 		icon: 'none'
				// 	});
				// 	return;
				// }
				if (self.status == false) {
					uni.showToast({
						title: '请勾选用车协议',
						duration: 2000,
						icon: 'none'
					});
					return;
				}


				let lineInformation = '';
				if (self.middle != '') {
					let a = [];
					self.middle.forEach(item => {
						a += item.m_longitude + "," + item.m_latitude + ";";
					});
					self.wayPoiStr = a.substring(0, a.length - 1);
					lineInformation = JSON.stringify(self.middle)
				}

				let waypoistr = self.wayPoiStr;
				let star_address = JSON.stringify(self.begin)
				let end_address = JSON.stringify(self.destination)
				let scheduling = JSON.stringify(self.scheduling)
				//console.log(self.formData.settlement_type);
				//console.log(end_address);
				//return;

				self._post('order.CarOrder/add', {
						star_address,
						lineInformation,
						end_address,
						waypoistr,
						scheduling,
						...self.formData
					},
					function(res) {
						let id = res.data.id;
						if (self.formData.front_money != ''&&self.formData.front_money!='0.00') {
							uni.navigateTo({
								url: '/pagesUser/paymentPage/paymentPage?select=1&&order_id=' + res.data.id
							})
						} else {
							self._post(
								'order.CarOrder/order_pay', {
									order_id: id,
									type: 1,
									password: ''
								},
								function(data) {
									if (data.code == 1) {
										uni.showModal({
											title: '下单成功',
											success(res) {
												if (res.cancel || res.confirm) {
													uni.navigateTo({
														url: '/pagesUser/journey/journey'
													})
												}
											}
										})
									}
									uni.hideLoading();
								});
						}
					});
			},
			/* 获取消息 */
			getInfo() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('plus.article.Article/detail', {
						article_id: 10019
					},
					function(res) {
						self.listData = res.data.detail;
						self.loadding = true;
						uni.hideLoading();
					});
			},
			gotoPage(path) {
				let self = this;
				if (path.startsWith('/')) {
					uni.navigateTo({
						url: path
					});
				} else {
					self[path]();
				}
			},
		}
	}
</script>

<style lang="scss">
	@import 'custom-car.scss';
</style>
